Skip to content

feat(dashboards): add live activity dashboard widget#13

Open
lordspline wants to merge 5 commits into
masterfrom
capy/feat-dashboards-live-activity-widget
Open

feat(dashboards): add live activity dashboard widget#13
lordspline wants to merge 5 commits into
masterfrom
capy/feat-dashboards-live-activity-widget

Conversation

@lordspline

@lordspline lordspline commented Jun 17, 2026

Copy link
Copy Markdown

Problem

Dashboards do not have a compact first-party way to show what is happening right now. This product experiment adds a narrowly scoped live activity tile inspired by PostHog#62806 without introducing a separate analytics engine.

Changes

  • Adds a live_activity dashboard widget type to the backend registry, catalog, default layout, generated config schemas, frontend registry, and MCP generated surfaces.
  • Runs bounded HogQL queries for a fixed 5-minute rolling window: active distinct IDs, a 20-bucket activity pulse, and a short recent-events feed capped at 10 rows.
  • Labels web, mobile, and backend activity from event name, $lib, and target properties without per-row person lookups.
  • Adds a WidgetCard UI with loading, empty, delayed, error-through-card-shell, permissions-through-registry, pause/resume, manual refresh, hidden-tab auto-pause, narrow layout, edit modal, story fixtures, and preview states.
  • Keeps the generated config contract as the source of truth and adds coverage for widget registry/config/query/layout behavior.

How did you test this code?

As an agent, I ran:

  • hogli build:openapi && hogli build:widget-types
  • hogli test products/dashboards/backend/api/test/test_run_widgets.py products/dashboards/backend/api/test/test_dashboard_widgets.py products/dashboards/backend/api/test/test_widget_config_schema_parity.py products/dashboards/backend/test/test_widget_layouts.py products/dashboards/backend/widgets/test/test_live_activity_widget.py — 148 passed
  • Frontend widget Jest suite — 41 passed
  • pnpm --filter=@posthog/frontend typescript:check
  • MCP typecheck/vitest for generated dashboard tool schemas — 1829 tests passed
  • Query sanity through the live widget runner with CLICKHOUSE_DATABASE=posthog: 3.35s locally, 4 active users, 5 events in window, seeded web/mobile/backend events visible
  • Running-app verification on a seeded dashboard: live events rendered, pause produced 0 scheduled run_widgets requests over 17s, simulated document.hidden=true produced 0 scheduled requests over 17s, and resume/manual refresh picked up delayed events

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Docs update

No docs update for this experiment PR. The widget copy documents the fixed 5-minute window and hidden-tab pause behavior inline.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Captain Capy implemented this PR from a human request, using the dashboard-widget management workflow and generated API/type tooling. Two deterministic visual directions were explored before implementation; the selected direction keeps the tile compact, uses existing dashboard widget/query infrastructure, and avoids high-frequency polling, unbounded payloads, and per-row requests.

The hidden-tab behavior was verified by simulating document.hidden=true in Playwright because headed/headless browser tabs remained visible in this environment.

Open POST-034 POST-034


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@lordspline lordspline added the capy Generated by capy.ai label Jun 17, 2026 — with Capy AI

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 3 comments

Comment thread products/dashboards/backend/widgets/live_activity.py Outdated
Comment thread services/mcp/src/generated/dashboards/api.ts Outdated
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 1 comment

Comment thread products/dashboards/backend/widget_specs/openapi.py
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 1 comment

Comment thread products/dashboards/backend/widget_specs/openapi.py Outdated
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 1 comment

Comment thread products/dashboards/frontend/generated/api.schemas.ts Outdated
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capy Generated by capy.ai

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant